<?php

header("Access-Control-Allow-Origin:*");

// $useremail = $_POST["useremail"];
$password = $_POST["password"];
$userphonenumber = $_POST["userphonenumber"];

# 链接数据库 : 

$con = mysqli_connect("localhost" , "root" , "root" , "meng3");

// $password = md5( $password );

# 编写sql语句; 
# - 字符串拼接; 
$sql_insert = 'INSERT INTO `oneheart` VALUES ( null ,"'. $password .'", "'. $userphonenumber .'")';

# 执行sql语句; 

$res = mysqli_query( $con , $sql_insert );

if( $res ){
      echo '{"type":"success"}';
}else{
      echo '{"type":"error","msg":"'. mysqli_error($con) .'"}';
}

# 关闭数据库

mysqli_close( $con );
